package com.example.persistence;

import com.example.domain.BaseEntity;
import com.example.persistence.exception.PersistenceException;

import java.util.List;
import java.util.Optional;

/**
 * @author 01
 * @date 2019-10-05
 **/
public interface PersistenceService {

    <T extends BaseEntity> List<T> list(Class<T> type) throws PersistenceException;

    <T extends BaseEntity> Optional<T> get(Class<T> type, Long id) throws PersistenceException;

    void save(BaseEntity entity) throws PersistenceException;

    <T extends BaseEntity> void delete(Class<T> type, Long id) throws PersistenceException;
}
